function HandlePAssistantScoreSheet(gui, user, date, options, data) {
  this._gui = gui;
  this._user = user;
  this._date = date;
  this._options = options;
  this._data = data;
  this._search = PPublishUtils.scoresheetSearch();

  this._page = 1;
  this._order = 't.deadline';
  this._queue = 'ASC';
  this._popupBox = new ModulePopupBox();
  
  this._createElements();
};

HandlePAssistantScoreSheet.prototype._createElements = function() {
  var tr, td, _self = this;
  
  DOMUtils.removeTableRows(this._gui.main, 1);
  //*** Here ***
  new HandleScoreSheetSearch(this._gui, this._user, this._date, { search: this._search /* Added */, callbackFunc: function(search) { _self._search = search; _self._page = 1; _self._retrieveTasks.call(_self); } }, this._data);

  //*** Here ***
  if (this._data['tasks'].length == 0) {
    tr = this._gui.main.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 4;
    td.style.textAlign = 'left';
    td.style.height = '23px';
    td.appendChild(document.createTextNode('n/a'));
  }
  
  for (var i = 0, il = this._data['tasks'].length; i < il; i++) {
    var task = this._data['tasks'][i];
    tr = this._gui.main.insertRow(-1);
    tr.style.backgroundColor = (tr.rowIndex % 2 == 0) ? '#ececec' : '#fff';

    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #bbb';
    td.style.height = '23px';
    td.style.paddingLeft = '5px';
    td.style.textAlign = 'left';
    var a = document.createElement('a');
    a.href = '#';
    a._name = task.name;
    a.onclick = function() { var w = window.open('?t=passistantscoresheetdetail&opt=' + JSON.stringify({ name: this._name, cond: HandleScoreSheetSearch.toSql(_self._search) }), 'ScoreDetail', 'width=1050,height=768,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no', true);
                             w.focus();
                           };
    a.appendChild(document.createTextNode(task.name));
    td.appendChild(a)
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #bbb';
    td.style.height = '23px';
    td.style.paddingLeft = '5px';
    td.style.textAlign = 'left';
    td.appendChild(document.createTextNode(task.count));
    
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #bbb';
    td.style.height = '23px';
    td.style.paddingLeft = '5px';
    td.style.textAlign = 'left';
    td.appendChild(document.createTextNode(parseFloat(task.score / task.count).toFixed(1)));

    td = tr.insertCell(-1);
    td.style.height = '23px';
    td.style.paddingLeft = '5px';
    td.style.textAlign = 'left';
    td.appendChild(document.createTextNode(task.scount));
  }
  
};


HandlePAssistantScoreSheet.prototype._retrieveTasks = function(pos) {
  var _self = this;
  var base = this._data['cond'];
  var args = '&c=' + JSON.stringify(((base) ? base + ' AND ' + HandleScoreSheetSearch.toSql(this._search) : HandleScoreSheetSearch.toSql(this._search))) + '&ts=' + JSON.stringify(this._data['table_select']) + '&tj=' + JSON.stringify(this._data['table_join']) + '&o=' + this._order + '&q=' + this._queue + '&p=' + this._page;
  new RequestUtils()._mysql('searchscoresheet', args, function(result, params) { _self._data['tasks'] = result;
                                                                                 _self._createElements();
                                                                               }, {pos: (pos) ? pos : null});
};
